﻿using System;
using System.Linq;

namespace _100RandomNum
{
    class Program
    {
        static void Main(string[] args)
        {
            int i;
            int[] Num = new int[100];
            Random rand = new Random();
            int sum;
           
            for (i = 0; i < Num.Length; i++)
            {
                Num[i] = rand.Next(1000);
            }
            int[] arr = Num.Select(x => x).OrderByDescending(x => x).ToArray();
            Console.WriteLine("从大到小排序：");
            for (i = 0; i < 100; i++)
            {
                Console.WriteLine(arr[i]);
            }
            var Sum = (from n in Num select n).Sum();
            Console.WriteLine("和为：" + Sum);
            var AVG = (from n in Num select n).Average();
            Console.WriteLine("平均值：" + AVG);
        }
    }
}
